package com.vietnam.power.domain;

import java.util.Date;

public class MessageInfo {
	private int id;
	private String content;
	private boolean status;
	private String subject;
	private String from;
	private String to;
	private String cc;
	private String phone;
	private String name;
	private String type;
	private Date createdDate;

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from_id) {
		this.from = from_id;
	}

	public String getTo() {
		return to;
	}

	public void setTo(String to) {
		this.to = to;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public String getCc() {
		return cc;
	}

	public void setCc(String cc) {
		this.cc = cc;
	}

	public void convertToDomain(com.vietnam.power.persitence.MessageInfo m) {
		this.id = m.getId();
		this.subject = m.getSubject();
		this.status = m.getStatus();
		this.content = m.getContent();
		this.from = m.getFrom();
		this.to = m.getTo();
		this.type = m.getMessageTypeDictionary().getName();
		this.createdDate = m.getCreatedDate();
		this.cc = m.getCc();
	}

	public void convertToPersist(com.vietnam.power.persitence.MessageInfo m) {
		m.setContent(this.content);
		m.setStatus(this.status);
		m.setSubject(this.subject);
		m.setFrom(this.from);
		m.setTo(this.to);
		m.setCc(this.cc);
	}

	public String getContentNl2br() {
		return this.content.replaceAll("\n", "<br/>");
	}
}
